package com.kuang.service;

import com.kuang.dao.BooksMapper;
import com.kuang.pojo.Books;

import java.util.List;

public class BookServiceImpl implements BookService {

  //调用一个dao层的操作，来设置一个set（）方法，成为一个接口从而方便后面维护
    private BooksMapper booksMapper;
//set（）方法
    public void setBooksMapper(com.kuang.dao.BooksMapper booksMapper) {
        this.booksMapper = booksMapper;
    }

    public Books queryBookById(int id) {
        return booksMapper.queryBookById(id);
    }

    public List<Books> queryAllBooks() {
        return booksMapper.queryAllBooks();
    }

    public Integer addBook(Books book) {
        return booksMapper.addBook(book);
    }

    public Integer updateBook(Books book) {
        return booksMapper.updateBook(book);
    }

    public Integer deleteBookById(int id) {
        return booksMapper.deleteBookById(id);
    }

    public Books queryBookName(String bookName) {
        return booksMapper.queryBookName(bookName);
    }
}
